package com.example.designpartten.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @author hql
 * @date 2020/4/15 15:58
 */
public class SubOrg extends Org {

    List<Org> subOrgs = new ArrayList<>();

    public SubOrg(String name, Integer num) {
        super(name, num);
    }

    public void addSubOrg(Org org) {
        //定义父级
        org.parentOrg(org);
        //增加子节点
        this.subOrgs.add(org);
    }

    public List<Org> getSubOrgs() {
        return this.subOrgs;
    }

}
